#ifndef VRP_LIT_PASS_INCLUDED
#define VRP_LIT_PASS_INCLUDED


#include "Common.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "VLighting.hlsl"
#include "VLights.hlsl"
#include "VInput.hlsl"
#include "../Shaders/VLitInput.hlsl"

struct Attributes
{
    float4 positionOS       : POSITION;
    float3 normalOS         :NORMAL;
    float2 texcoord          :TEXCOORD0;
};

struct Varyings
{
    float2 uv         :TEXCOORD0;
    float3 positionWS :TEXCOORD1;
    float3 normalWS   :TEXCOORD2;
    float3 viewDirWS  :TEXCOORD3;
    
    float4 positionCS : SV_POSITION;//clip space
};
void InitializeInputData(Varyings input,out VInputData inputData)
{
    inputData = (VInputData)0;
    inputData.positionWS=input.positionWS;

    
    inputData.normalWS = input.normalWS;
    inputData.viewDirectionWS=input.viewDirWS;
    
    
}
Varyings vert(Attributes input)
{
    Varyings output = (Varyings)0;
    output.uv=input.texcoord;
    output.positionWS = TransformObjectToWorld(input.positionOS.xyz);
    output.positionCS = TransformWorldToHClip(output.positionWS);
    output.normalWS=normalize(TransformObjectToWorldNormal(input.normalOS));
    output.viewDirWS=normalize(GetCameraPositionWS()-output.positionWS);
    return output;
}

half4 frag(Varyings input) : SV_Target
{
    VSurface surfaceData;
    InitializeStandardLitSurfaceData(input.uv, surfaceData);
    
    VInputData inputData;
    InitializeInputData(input,inputData);
    half4 recolor = VUniversalFragmentPBR(inputData, surfaceData);
    
    //return float4(input.positionWS,1);
    return recolor;
}
#endif